Skip to content

Conversation

@avilagaston9
Copy link
Contributor

@avilagaston9 avilagaston9 commented Oct 30, 2025

Motivation

First step toward our shared bridge implementation, ensuring transaction availability through blobs and simplifying our L1 fee mechanism.

Description

Currently, data availability is achieved by publishing State diffs through blobs.
In this PR, we change that approach by directly publishing all the blocks of a batch (RLP-encoded) within the blobs, along with their corresponding Fee configs.

#5235 was created to improve our estimate gas mechanism.

Closes None

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Lines of code report

Total lines added: 354
Total lines removed: 388
Total lines changed: 742

Detailed view
+--------------------------------------------------------------+-------+------+
| File                                                         | Lines | Diff |
+--------------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/l2/command.rs                              | 643   | +15  |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/common/types/l2.rs                             | 2     | -1   |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/common/types/l2/fee_config.rs                  | 232   | +207 |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/common/types/transaction.rs                    | 2860  | +6   |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/l2/based/block_fetcher.rs                      | 365   | -143 |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/l2/common/src/lib.rs                           | 6     | -1   |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/l2/prover/src/guest_program/src/execution.rs   | 356   | -55  |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/block_producer/payload_builder.rs | 195   | -82  |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/errors.rs                         | 380   | -5   |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/l1_committer.rs                   | 1055  | -8   |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/l2/utils/error.rs                              | 34    | +13  |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/l2/utils/mod.rs                                | 4     | +1   |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/l2/utils/state_reconstruct.rs                  | 99    | +99  |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/eth/transaction.rs              | 578   | +3   |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/vm/backends/levm/mod.rs                        | 636   | +10  |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/hooks/hook.rs                      | 30    | -3   |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/hooks/l2_hook.rs                   | 234   | -13  |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/utils.rs                           | 426   | -77  |
+--------------------------------------------------------------+-------+------+

@avilagaston9 avilagaston9 self-assigned this Nov 3, 2025
@github-actions
Copy link

github-actions bot commented Nov 5, 2025

Benchmark Results Comparison

No significant difference was registered for any benchmark run.

Detailed Results

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
main_revm_BubbleSort 3.004 ± 0.050 2.970 3.126 1.00
main_levm_BubbleSort 3.254 ± 0.026 3.233 3.321 1.08 ± 0.02
pr_revm_BubbleSort 3.013 ± 0.071 2.971 3.205 1.00 ± 0.03
pr_levm_BubbleSort 3.270 ± 0.060 3.217 3.418 1.09 ± 0.03

Benchmark Results: ERC20Approval

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Approval 974.3 ± 9.3 964.0 997.6 1.00 ± 0.02
main_levm_ERC20Approval 1152.0 ± 5.9 1142.7 1163.6 1.18 ± 0.02
pr_revm_ERC20Approval 974.2 ± 11.7 965.2 1003.5 1.00
pr_levm_ERC20Approval 1164.5 ± 4.9 1157.4 1171.3 1.20 ± 0.02

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 131.6 ± 0.6 130.5 132.6 1.00
main_levm_ERC20Mint 168.9 ± 0.7 167.9 170.0 1.28 ± 0.01
pr_revm_ERC20Mint 132.0 ± 0.7 131.3 133.8 1.00 ± 0.01
pr_levm_ERC20Mint 176.0 ± 19.2 168.8 230.7 1.34 ± 0.15

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 230.2 ± 1.7 229.1 234.7 1.00
main_levm_ERC20Transfer 287.8 ± 2.6 284.6 293.3 1.25 ± 0.01
pr_revm_ERC20Transfer 233.0 ± 3.2 229.5 238.9 1.01 ± 0.02
pr_levm_ERC20Transfer 288.7 ± 1.6 286.6 291.3 1.25 ± 0.01

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 223.3 ± 1.2 221.5 224.9 1.00 ± 0.01
main_levm_Factorial 276.3 ± 3.1 272.1 280.7 1.24 ± 0.02
pr_revm_Factorial 223.1 ± 1.2 220.7 224.7 1.00
pr_levm_Factorial 269.4 ± 1.7 267.7 273.2 1.21 ± 0.01

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.583 ± 0.043 1.507 1.656 1.00
main_levm_FactorialRecursive 8.542 ± 0.035 8.465 8.583 5.40 ± 0.15
pr_revm_FactorialRecursive 1.616 ± 0.027 1.574 1.674 1.02 ± 0.03
pr_levm_FactorialRecursive 8.648 ± 0.036 8.590 8.710 5.46 ± 0.15

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 204.2 ± 1.1 202.0 206.0 1.00
main_levm_Fibonacci 267.6 ± 2.3 262.8 269.7 1.31 ± 0.01
pr_revm_Fibonacci 204.4 ± 2.0 200.8 208.1 1.00 ± 0.01
pr_levm_Fibonacci 261.3 ± 3.3 256.1 265.8 1.28 ± 0.02

Benchmark Results: FibonacciRecursive

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_FibonacciRecursive 827.4 ± 10.1 819.1 846.9 1.08 ± 0.02
main_levm_FibonacciRecursive 769.5 ± 32.5 737.2 854.9 1.00 ± 0.04
pr_revm_FibonacciRecursive 841.7 ± 6.6 832.5 854.6 1.10 ± 0.01
pr_levm_FibonacciRecursive 766.0 ± 7.0 756.1 781.6 1.00

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.4 ± 0.1 8.4 8.6 1.00
main_levm_ManyHashes 9.8 ± 0.1 9.7 10.0 1.17 ± 0.01
pr_revm_ManyHashes 8.5 ± 0.1 8.4 8.7 1.00 ± 0.01
pr_levm_ManyHashes 9.8 ± 0.1 9.7 9.9 1.16 ± 0.01

Benchmark Results: MstoreBench

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_MstoreBench 266.8 ± 7.2 260.5 279.0 1.12 ± 0.03
main_levm_MstoreBench 238.6 ± 1.4 236.0 240.9 1.00
pr_revm_MstoreBench 260.9 ± 0.7 259.8 262.2 1.09 ± 0.01
pr_levm_MstoreBench 238.7 ± 1.9 236.8 242.0 1.00 ± 0.01

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 292.9 ± 1.0 291.6 294.8 1.00 ± 0.01
main_levm_Push 308.2 ± 2.2 305.9 312.2 1.05 ± 0.01
pr_revm_Push 292.6 ± 1.1 291.2 295.0 1.00
pr_levm_Push 310.8 ± 0.9 309.2 312.2 1.06 ± 0.01

Benchmark Results: SstoreBench_no_opt

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_SstoreBench_no_opt 168.3 ± 3.0 161.6 172.2 1.88 ± 0.08
main_levm_SstoreBench_no_opt 89.4 ± 3.3 86.7 97.8 1.00
pr_revm_SstoreBench_no_opt 167.5 ± 2.8 161.8 171.0 1.87 ± 0.08
pr_levm_SstoreBench_no_opt 89.7 ± 1.8 87.7 91.9 1.00 ± 0.04

@github-actions github-actions bot added the L2 Rollup client label Nov 6, 2025
@avilagaston9 avilagaston9 marked this pull request as ready for review November 6, 2025 21:25
Copilot AI review requested due to automatic review settings November 6, 2025 21:25
@avilagaston9 avilagaston9 requested a review from a team as a code owner November 6, 2025 21:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR deprecates the state diff-based data availability mechanism in favor of publishing full transaction lists in blobs. This significantly simplifies the codebase by removing complex state diff calculation and encoding logic.

Key Changes:

  • Removed state diff calculation and encoding infrastructure from L2 hooks, payload builder, and prover
  • Modified blob generation to encode transaction lists and fee configs instead of state diffs
  • Updated L1 fee calculation to use transaction size instead of account diff size
  • Added deprecation warning in state diff documentation

Reviewed Changes

Copilot reviewed 27 out of 33 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
docs/l2/fundamentals/state_diff.md Added deprecation warning for state diff-based data availability
docs/l2/fundamentals/data_availability.md Added placeholder for new data availability documentation
docs/l2/block_vs_state_diff_measurements.md Added comprehensive measurement documentation comparing state diffs vs transaction lists
crates/vm/levm/src/utils.rs Removed get_account_diffs_in_tx function and related imports
crates/vm/levm/src/hooks/l2_hook.rs Removed state diff calculation, switched to transaction size for L1 fee calculation
crates/vm/levm/src/hooks/hook.rs Simplified L2 hook initialization
crates/vm/backends/levm/mod.rs Added get_max_allowed_gas_limit function and improved GenericTransaction conversion
crates/networking/rpc/eth/transaction.rs Updated estimate gas to use new gas limit cap
crates/l2/utils/state_reconstruct.rs New file with state reconstruction utilities
crates/l2/utils/mod.rs Added state_reconstruct module
crates/l2/utils/error.rs Added new error variants for state reconstruction
crates/l2/tests/tests.rs Updated tests to calculate transaction sizes instead of account diff sizes
crates/l2/storage/src/store_db/sql.rs Renamed parameter from state_diff to blobs
crates/l2/sequencer/l1_committer.rs Major refactor to generate blobs from transaction lists instead of state diffs
crates/l2/sequencer/errors.rs Removed StateDiffError references
crates/l2/sequencer/block_producer/payload_builder.rs Simplified transaction selection using encoded size instead of state diff size
crates/l2/prover/src/guest_program/src/execution.rs Updated blob verification to use transaction lists
crates/l2/contracts/src/l1/OnChainProposer.sol Renamed stateDiffKZGVersionedHash to BlobKZGVersionedHash
crates/l2/common/src/state_diff.rs Entire file deleted
crates/l2/common/src/lib.rs Removed state_diff module
crates/l2/based/block_fetcher.rs Refactored to use shared state reconstruction utility
crates/l2/Makefile Removed reconstruct command parameter
crates/common/types/l2.rs Removed account_diff module
fixtures/blobs/6-1.blob New blob fixture file
Comments suppressed due to low confidence (1)

docs/l2/fundamentals/state_diff.md:4

  • Corrected spacing: there should be no space between 'state' and 'diffs' when enclosed in backticks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@avilagaston9 avilagaston9 moved this to In Review in ethrex_l2 Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L2 Rollup client

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

4 participants